package com.oim.function.ui.device;

import org.controlsfx.tools.Borders;

import javafx.scene.Node;
import javafx.scene.layout.VBox;

public class DeviceInfoPanel extends VBox {

	CpuInfoPanel cpuInfoPanel = new CpuInfoPanel();
	ItemInfoPanel memoryInfoPanel = new ItemInfoPanel();
	ItemInfoPanel diskInfoPanel = new ItemInfoPanel();

	public DeviceInfoPanel() {

		initComponent();
		initEvent();
	}

	private void initComponent() {
		this.setSpacing(10);

		// Borders borders = Borders.wrap(cpuInfoPanel);
		// borders.lineBorder().title("Line").thickness(1).radius(0, 5, 5,
		// 0).build();

		Node cpuInfoNode = Borders.wrap(cpuInfoPanel).lineBorder().title("CPU").thickness(1).radius(0, 5, 5, 0).build().build();
		Node memoryInfoNode = Borders.wrap(memoryInfoPanel).lineBorder().title("内存").thickness(1).radius(0, 5, 5, 0).build().build();
		Node diskInfoNode = Borders.wrap(diskInfoPanel).lineBorder().title("硬盘").thickness(1).radius(0, 5, 5, 0).build().build();

		this.getChildren().add(cpuInfoNode);
		this.getChildren().add(memoryInfoNode);
		this.getChildren().add(diskInfoNode);
		memoryInfoPanel.setName("内存大小:");
		diskInfoPanel.setName("硬盘大小:");
	}

	private void initEvent() {
		// TODO Auto-generated method stub

	}

	public void setCpuCount(int count) {
		cpuInfoPanel.setCount(count + "");
	}

	public void setCpuUseRate(int useRate) {
		cpuInfoPanel.setUseRate(useRate + "%");
	}

	public void setMemorySize(int count) {
		memoryInfoPanel.setCount(count + "MB");
		;
	}

	public void setMemoryUseRate(int useRate) {
		memoryInfoPanel.setUseRate(useRate + "%");
	}

	public void setDiskSize(int count) {
		diskInfoPanel.setCount(count + "GB");
		;
	}

	public void setDiskUseRate(int useRate) {
		diskInfoPanel.setUseRate(useRate + "%");
	}

}
